if (document.URL.indexOf("http://www.mafengwo.cn/travel-scenic-spot/mafengwo") !== -1) {
  chrome.runtime.sendMessage({
    message: "",
    extra: document.getElementsByClassName("item cur")[0].textContent
  });
} else if (document.URL.indexOf("http://www.mafengwo.cn/poi") !== -1) {
  let extra = {}
  let title = document.getElementsByClassName("title")[0]
  extra.name = title.getElementsByTagName("h1")[0].textContent
  extra.nameEn = title.getElementsByTagName("div")[0].textContent
  extra.summary = document.getElementsByClassName("summary")[0].textContent
  let tel = document.getElementsByClassName("tel")
  if (tel.length > 0) {
    extra.contact = tel[0].getElementsByClassName("content")[0].textContent
  }
  let dls = document.getElementsByTagName("dl")
  for (let i = 0; i < dls.length; i++) {
    if (dls[i].textContent.indexOf("门票") !== -1) {
      extra.ticketInfo = dls[i].getElementsByTagName("div")[0].textContent
      break;
    }
  }
  chrome.runtime.sendMessage({
    message: "",
    extra: extra
  });
} else if (document.URL.indexOf("http://www.mafengwo.cn/photo/poi") !== -1) {
  let pics = document.getElementsByClassName("a-pic")
  for (let i = 0; i < pics.length; i++) {
    chrome.runtime.sendMessage({
      message: "",
      extra: pics[i].src
    });
  }
}
